CXXFLAGS      = -std=c++0x -Wall -march=native -O3 -MMD
CXXFLAGS_TEST = -std=c++0x -Wall -O1 -g

DEMO_BIN = demo
DEMO_OBJ = demo.o norx.o norx_bits.o

TEST_SRC  = test.cpp norx.cpp norx_bits.cpp
TEST_DEPS = $(TEST_SRC) array_ref.hpp integers.hpp norx_bits.hpp norx.hpp norx_perm.hpp

all: test demo

test: $(TEST_DEPS) Makefile
	$(CXX) $(CPPFLAGS) $(CXXFLAGS_TEST) -o $@ $(TEST_SRC)

$(DEMO_BIN): test.success $(DEMO_OBJ)
	$(CXX) $(LDFLAGS) -o $@ $(DEMO_OBJ)

test.success: test
	./test && touch test.success

clean:
	$(RM) *.o *.d test $(DEMO_BIN) test.success

-include *.d

.PHONY: all clean

